<template>
	<view class="page">
		<u-cell-group>
			<u-cell isLink :title="item.name" v-for="(item, index) in list" :key="index" :url="'/pages/faq/detail?id='+item.id">
			</u-cell>
		</u-cell-group>
		<u-gap height="10" bgColor="#fff"></u-gap>
		<u-loadmore :status="has_more==true?'loading':'nomore'"/>
	</view>
</template>

<script>
	import {
	} from 'vuex';
	export default {
		data() {
			return {
				page: 1,
				has_more: true,
				list: [],
			};
		},
		onLoad: function(options) {
			this.utils.hideShare()
			this.ajax()
		},
		onReachBottom() {
			if (this.has_more) {
				this.ajax()
			}
		},
		methods: {
			ajax() {
				this.http('faq/index', {page:this.page}, 'get').then(res => {
					var data = res.data.data;
					this.list = this.list || [];
					this.list = this.list.concat(data);
					this.has_more = res.data.has_more;
					this.page++;
				});
			},
			goto(page) {
				this.utils.goto(page)
			},
		}
	};
</script>

<style lang="scss">
	.page{
		background-color: #fff;
	}
</style>
